﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="courses.aspx.cs" Inherits="school_courses" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script src="../include/js/form.js" type="text/javascript"></script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="bodyContentTop" runat="Server">
    <h1>
        Courses</h1>
    <h3>
        How many Courses have in selected school?.</h3>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="bodyContent" runat="Server">
    <div class="elements_inner_wrapper">
        <div id="contentBody">
            <div class="section">
                <div class="seperator">
                </div>
                <fieldset class="formouter">
                    <table cellpadding="3" cellspacing="3" width="100%">
                        <tr>
                            <td colspan="2">
                                <div class="row_curved" id="divSchoolList" runat="server" title="Example:UCSM, MIT, YTU">
                                    <label for="<%=ddlSchoolList.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="School Name" ID="Label2" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:DropDownList AutoPostBack="True" runat="server" ID="ddlSchoolList" OnSelectedIndexChanged="ddlSchoolList_SelectedIndexChanged"
                                                DataSourceID="odsSchoolProfileList" DataTextField="ListText" DataValueField="ListValue" />
                                            <asp:ObjectDataSource ID="odsSchoolProfileList" runat="server" DataObjectTypeName="SIS.ENT.Listing"
                                                DeleteMethod="Delete" OldValuesParameterFormatString="original_{0}" SelectMethod="GetList"
                                                TypeName="SIS.BLL.ListingManager" UpdateMethod="Save">
                                                <SelectParameters>
                                                    <asp:Parameter DefaultValue="1" Name="ListType" Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:RequiredFieldValidator ID="rfvSchoolList" ValidationGroup="Course" ControlToValidate="ddlSchoolList"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage="<br/>Please select a school name.<br/>"></asp:RequiredFieldValidator>
                                            &nbsp;&nbsp;
                                            <asp:Button Visible="false" runat="server" ID="btnShowCourse" Text="Show" OnClick="btnShowCourse_Click" />
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="row_curved" id="divSchoolMajor" runat="server" title="Example:UCSM, MIT, YTU">
                                    <label for="<%=ddlSchoolMajor.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Major" ID="Label1" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:DropDownList AutoPostBack="True" runat="server" ID="ddlSchoolMajor" OnSelectedIndexChanged="ddlSchoolMajor_SelectedIndexChanged"
                                                DataSourceID="odsSchoolMajor" DataTextField="Description" DataValueField="SchoolMajorKey" />
                                            <asp:ObjectDataSource ID="odsSchoolMajor" runat="server" DeleteMethod="Delete" OldValuesParameterFormatString="original_{0}"
                                                SelectMethod="GetList" TypeName="SIS.BLL.SchoolMajorTableManager">
                                                <DeleteParameters>
                                                    <asp:Parameter Name="SchoolMajorKey" Type="Int32" />
                                                </DeleteParameters>
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="ddlSchoolList" Name="SchoolKey" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="StandardLevel"
                                                ControlToValidate="ddlSchoolList" runat="server" CssClass="validationErrorControl"
                                                Display="Dynamic" ErrorMessage="<br/>Please select a school name.<br/>"></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="row_curved" id="divStandardLevel" runat="server" title="Example:UCSM, MIT, YTU">
                                    <label for="<%=ddlStandardLevel.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Standard/Level Name" ID="lblStandardLevel" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:DropDownList AutoPostBack="True" runat="server" ID="ddlStandardLevel" OnSelectedIndexChanged="ddlStandardLevel_SelectedIndexChanged"
                                                DataSourceID="odsStandarLevel" DataTextField="Description" DataValueField="StandardLevelKey"
                                                Style="height: 22px" />
                                            <asp:ObjectDataSource ID="odsStandarLevel" runat="server" OldValuesParameterFormatString="original_{0}"
                                                SelectMethod="GetList" TypeName="SIS.BLL.StandardLevelTableManager" DataObjectTypeName="SIS.ENT.StandardLevelTable"
                                                DeleteMethod="Delete" UpdateMethod="Save">
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="ddlSchoolList" Name="SchoolKey" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                    <asp:ControlParameter ControlID="ddlSchoolMajor" Name="SchoolMajorKey" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                </SelectParameters>
                                            </asp:ObjectDataSource>
                                            <asp:RequiredFieldValidator ID="rfvStandardLevel" ValidationGroup="Course" ControlToValidate="ddlStandardLevel"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage="<br/>Please select a standard level.<br/>"></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <h2>
                                    Course Listing</h2>
                                <p>
                                    <asp:ObjectDataSource ID="odsCourse" runat="server" DataObjectTypeName="SIS.ENT.CourseTable"
                                        DeleteMethod="Delete" OldValuesParameterFormatString="original_{0}" SelectMethod="GetList"
                                        TypeName="SIS.BLL.CourseTableManager" UpdateMethod="Save">
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="ddlSchoolList" Name="SchoolKey" PropertyName="SelectedValue"
                                                Type="Int32" />
                                            <asp:ControlParameter ControlID="ddlStandardLevel" Name="StandardLevelKey" PropertyName="SelectedValue"
                                                Type="Int32" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>
                                </p>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" valign="top">
                                <div>
                                    <asp:GridView ID="grvCourse" runat="server" AutoGenerateColumns="False" DataKeyNames="CourseKey,SchoolKey,StandardLevelKey"
                                        CellPadding="4" Width="650px" DataSourceID="odsCourse" ForeColor="#333333" GridLines="None"
                                        OnSelectedIndexChanged="grvCourse_SelectedIndexChanged">
                                        <RowStyle BackColor="#EFF3FB" />
                                        <Columns>
                                            <asp:BoundField DataField="CourseKey" HeaderText="CourseKey" InsertVisible="False"
                                                ReadOnly="True" SortExpression="CourseKey" Visible="False" />
                                            <asp:BoundField DataField="SchoolKey" HeaderText="SchoolKey" SortExpression="SchoolKey"
                                                InsertVisible="False" ReadOnly="True" Visible="False" />
                                            <asp:BoundField DataField="StandardLevelKey" HeaderText="StandardLevelKey" SortExpression="StandardLevelKey"
                                                InsertVisible="False" ReadOnly="True" Visible="False" />
                                            <asp:BoundField DataField="CourseCode" HeaderText="Code" SortExpression="CourseCode" />
                                            <asp:BoundField DataField="CourseName" HeaderText="Name" SortExpression="CourseName" />
                                            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                                            <asp:CheckBoxField DataField="Status" HeaderText="Status" SortExpression="Status" />
                                            <asp:BoundField DataField="CreatedDateTime" HeaderText="CreatedDateTime" SortExpression="CreatedDateTime"
                                                Visible="False" />
                                            <asp:BoundField DataField="ModifiedDateTime" HeaderText="ModifiedDateTime" SortExpression="ModifiedDateTime" />
                                            <asp:CommandField ButtonType="Button" ShowSelectButton="True" />
                                        </Columns>
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <EmptyDataTemplate>
                                            Please add new course of selected school and standard level.
                                        </EmptyDataTemplate>
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <AlternatingRowStyle BackColor="White" />
                                    </asp:GridView>
                                    <asp:ValidationSummary ID="vsCourse" runat="server" ValidationGroup="Course" ShowSummary="True"
                                        HeaderText="Please complete all highlighted fields of the form. Thank you." CssClass="errorSummary" />
                                    <asp:Label Visible="false" runat="server" Text="-1" ID="lblSchoolKey" />
                                    <asp:Label Visible="false" runat="server" Text="-1" ID="lblStandardLevelKey" />
                                    <asp:Label Visible="false" runat="server" Text="-1" ID="lblCourseKey" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top">
                                <h2>
                                    Course Details
                                </h2>
                                <div class="row_curved" id="divSchoolShortName" runat="server" title="Example:1-CS-ENG, BEHS-8-MM, 2nd-DIP-MATH">
                                    <label for="<%=txtCourseCode.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Code" ID="lblStandardLevelCode" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:TextBox Width="220px" ID="txtCourseCode" MaxLength="50" runat="server" />
                                            <asp:RequiredFieldValidator ID="rfvCourseCode" ValidationGroup="Course" ControlToValidate="txtCourseCode"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage=""></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divCourseName" runat="server" title="Example:1-CS-English, BEHS-8-Myanmar, 2nd-DIP-Mathematics">
                                    <label for="<%=txtCourseName.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Name" ID="lblCourseName" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:TextBox Width="220px" ID="txtCourseName" MaxLength="50" runat="server" />
                                            <asp:RequiredFieldValidator ID="rfvCourseName" ValidationGroup="Course" ControlToValidate="txtCourseName"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage=""></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divDescription" runat="server" title="Example:1st Year Computer Science English, BEHS-Standard 8-Myanmar, Second Year Diploma in Computer Science, Mathematics">
                                    <label for="<%=txtDescription.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Description" ID="lblDescription" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:TextBox Width="270px" ID="txtDescription" MaxLength="255" runat="server" />
                                            <asp:RequiredFieldValidator ID="rfvDescription" ValidationGroup="Course" ControlToValidate="txtDescription"
                                                runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage=""></asp:RequiredFieldValidator>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divOtherSchoolName" runat="server">
                                    <label for="<%=chkStatus.ClientID%>" class="mand_red">
                                        <asp:Label runat="server" Text="Status" ID="lblStatus" /></label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:CheckBox ID="chkStatus" runat="server" Text="" Checked="true" />
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="row_curved" style="background-color: #efefef;" id="divButton" runat="server">
                                    <label>
                                        &nbsp;</label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:Button ID="btnSubmit" CssClass="button_normal_submit" Text="Save" ValidationGroup="Course"
                                                OnClientClick="SubmitOnClientClick(this, 'Course');" runat="server" OnClick="btnSubmit_Click" /></span>
                                        &nbsp;&nbsp;<asp:Button runat="server" ID="btnAddNewSchool" Text="New" OnClick="btnAddNew_Click"
                                            Style="height: 26px" />
                                        &nbsp;&nbsp;<asp:Button runat="server" ID="btnDelete" OnClientClick="return confirm('Are you sure to delete?');"
                                            Text="Delete" OnClick="btnDelete_Click" />
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="row_curved" id="divMessage" runat="server">
                                    <label>
                                        &nbsp;</label>
                                    <div class="field">
                                        <span class="indicator">
                                            <asp:Label ID="lblMessage" Font-Bold="true" runat="server"></asp:Label>
                                        </span>
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        //<![CDATA[
        SetSumitNormalButtonAttribute(document.getElementById('<%=btnSubmit.ClientID%>'));
        //]]>
    </script>

</asp:Content>
